<?php

namespace App\Wechat;
use Liuhelong\LaravelAdmin\Wechat\Models\WechatOffiaccountBroadcast;

/***
*** 菜单位置发送事件 示例处理器
*** 
***/
class BroadcastNotify extends EventHandle implements EventHandleInterface
{
    
    /*
    *  获取用户和用户发送的位置，处理自定义逻辑
    */
    public function handle()
    {
        $broadcast = WechatOffiaccountBroadcast::where('msg_id',$this->message['MsgID'])->first();
        
        if(!$broadcast)
            return;
            
        $broadcast->update([
            'msg_status' => $this->message['Status'],
            'total_count' => $this->message['TotalCount'],
            'filter_count' => $this->message['FilterCount'],
            'sent_count' => $this->message['SentCount'],
            'error_count' => $this->message['ErrorCount']
        ]);
        
    }
}
